package com.swl.controller;

import com.swl.pojo.Answer;
import com.swl.service.AnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/answer")
public class AnswerController {
    @Autowired
    private AnswerService answerService;

    @RequestMapping("/insertAnswer")
    public Integer insertAnswer(@RequestParam("result") String result,@RequestParam("Topic.tid") int tid ){
        System.out.println(result+"======"+tid);
        return answerService.insertAnswer(result,tid);
    }

    @RequestMapping("/selectAnswerByTid")
    public Answer selectAnswerByTid(@RequestParam("tid") int tid){
        Answer answer=answerService.selectAnswerByTid(tid);
        System.out.println(answer);
        return answer;
    }
}
